from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from . import models


def Index(request, cid):
    # 查询所有类别信息
    category = models.Category.objects.all().order_by('id')
    # 查询当前类别下的所有商品信息
    goodslist = models.Goods.objects.filter(category_id=cid).order_by('id')
    context = {'category':category,'goodslist':goodslist}
    return render(request, 'index.html', context)
